/**
 * 存放方块的矩阵
 * by wyy
 */
class brickGrp extends GameObject implements eui.UIComponent {
    private data = {
        lineNum: 36,
        columnNum: 20
    };
    private brickArr: brick[][];
    constructor({ lineNum = 36, columnNum = 20 }) {
        super();
        this.skinName = "resource/eui_skins/game_skins/brickGrpSkin.exml";
        this.data.lineNum = lineNum;
        this.data.columnNum = columnNum;
    }
    addToStage() {

    }
    onRemove() { }
    async firstCreate() {
        let d = await RES.getResAsync("brickData_json");
        let lineNum = d["brickArr"]["lineNum"];
        let colNum = d["brickArr"]["columnNum"];
        let bData = d["brickArr"]["brickData"];
        //初始化二维数组
        for (let i = 0; i < lineNum; i++) {
            for (let j = 0; j < colNum; j++) {
                let b = new brick({ bgColor: bData[i][j]["color"], lifeMax: bData[i][j]["lifeMax"] });
                this.addChild(b);
                b.setPos(j * b.width + b.width / 2, i * b.height + b.height / 2);
            }
        }
    }

}